<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html>

<script type="text/javascript"> 
	 
 

	  var selArray=new Array();


$(document).ready(function () {


$("#add").click(function(){
		
		$("#select1 option:selected").appendTo("#select2");
		
		});
		
	$("#add_all").click(function(){
		
		$("#select1 option").appendTo("#select2");
		
		});
		
	$("#remove").click(function(){
		
		$("#select2 option:selected").appendTo("#select1");
		
		});	
		
	$("#remove_all").click(function(){
		
		$("#select2 option").appendTo("#select1");
		
		});	
		
		$("#select1").dblclick(function(){
			
		$("#select1 option:selected").appendTo("#select2");	
			
			});
		
				$("#select2").dblclick(function(){
			
		$("#select2 option:selected").appendTo("#select1");	
			
			});








$("#selMC").combobox({

onChange: function (n,o) {
 //alert("------");
 var mv=$("#selMC").combobox('getValue');
//var mc= $("#selMC").combobox('getText');
 //document.getElementById("selMC").value;
//  alert("++++++"+mv);
 // alert("====="+mc);
      document.getElementById("msgContent").value =mv;
}

});




//var mydate=new Date();
//var md=mydate.toLocaleString();
var now = new Date();
       
        var year = now.getFullYear();       //年
        var month = now.getMonth() + 1;     //月
        var day = now.getDate();            //日
       
        var hh = now.getHours();            //时
        var mm = now.getMinutes()+1;          //分
       
        var clock = year + "-";
       
        if(month < 10)
            clock += "0";
       
        clock += month + "-";
       
        if(day < 10)
            clock += "0";
           
        clock += day + " ";
        
         if(hh < 10)
            clock += "0";
           
        clock += hh + ":";
        if (mm < 10) clock += '0'; 
        clock += mm; 

$('#ttt').datetimebox({
	  required: true,    
    showSeconds: true,  
     value: clock, 
    onchange: function(){
        alert(date);
    }
});

});





 $(document).ready(function() {  
            var select = $("#select1");  
            $.get("${pageContext.request.contextPath}/message/messageAction!getEmpJSON.action", null, function(data) {  
                var jsonData = eval(data);//接收到的数据转化为JQuery对象，由JQuery为我们处理  
                $.each(jsonData, function(index, objVal) { //遍历对象数组，index是数组的索引号，objVal是遍历的一个对象。  
                    //val["属性"]可取到对应的属性值。  
                   // alert(objVal["text"]);
                    $("<option>").attr("value", objVal["id"]).html(objVal["text"]).appendTo("#select1");  
                });  
            });  
        });

function selectValue(){

var selectedComs = document.getElementById("select2");
for(var i=0;i<selectedComs.length;i++){
selectedComs.options[i].selected = true;
}
}


function selectEmp(){

 $('#dd').window('open');  // open a window    
// location.reload();
 //$('#dd').window('refresh');
$("#empdatagrid").datagrid('load'); //重新加载
}

function doeQuery() {
    if ($("#emp_datasource_query_form").form("validate")) {
   // alert($("#edatasource_datsourcename").val()+"!!!");
        $("#empdatagrid").datagrid('options').queryParams = serializeObject($("#edatasource_datsourcename")); //把查询条件赋值给datagrid内部变量
        $("#empdatagrid").datagrid('load'); //重新加载
    }
}
//重置查询条件
function doeReset() {
  // alert("！！！！！");
   document.getElementById("edatasource_datsourcename").value="";
   doeQuery();
}



$(function () {
    //查询按纽绑定事件
    $('#ebtnQuery').bind('click', doeQuery);
    //重置按纽绑定事件
    $('#ebtnReset').bind('click', doeReset);
    //初始化主列表
    $('#empdatagrid').datagrid({
        url: '${pageContext.request.contextPath}/cnbdw/employeeAction!getPunchAllDatasourceList.action',
       fit : true,
							border : false,
							fitColumns : true,
							pagination : true,
							pageList : [30],
							rownumbers : false,
							sortName : 'id',
							sortOrder : 'desc',
							striped : true,
       
        columns: [
            [
               {field: 'id', title: '唯一编号', align: 'left',checkbox:'true', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
                {field: 'photo', title: '照片', align: 'left', formatter: function (value, rowData, rowIndex) {
                    if ($.trim(value) != '') {
                        return '<img src="${pageContext.request.contextPath}' + value + '" style="width: 30px; height: 30px;">';
                    }
                    return '--';
                }},
                {field: 'name', title: '姓名', align: 'left', formatter: function (value, rowData, rowIndex) {
                    if (value == '') {
                        return '--'
                    }
                    return value;
                }},
					{
										field : 'gender',
										title : '性别',
										align : 'left',
										formatter : function(value, rowData,
												rowIndex) {
											if (value == 1) {
												return '男'
											} else {
												return '女'
											}
											return value;
										}
									},
                {field: 'cardType', title: '证件类型', align: 'left', formatter: function (value, rowData, rowIndex) {
                    if (value == 1) {
                        return '身份证'
                    } else if(value == 2){
                        return '军官证'
                    }
                    return value;
                }},
                {field: 'cardNo', title: '证件号码', align: 'left', formatter: function (value, rowData, rowIndex) {
                    if (value == '') {
                        return '--'
                    }
                    return value;
                }},
									{
										field : 'company',
										title : '单位',
										align : 'left',
										formatter : function(value, rowData,
												rowIndex) {
											if (value == '') {
												return '--'
											}
											return value;
										}
									}
            ]
        ]
    });
});
function show(){
document.getElementById("su").style.display="";

}
function hide(){

document.getElementById("su").style.display="none";
}


</script>

<table style="width: 100%;" class="listtable">
	<tr class="row-even">
		<td class="tr_left"><span class="required">*</span>标题:&nbsp;</td>
		<td class="tr_right"><input type="text" name="msgTitle"
			value="通知" maxlength="200" class="easyui-validatebox"
			data-options="required:true,missingMessage:'请输入标题'" /></td>
	</tr>
	<tr>
		<td class="tr_left"><span class="required">*</span>内容:&nbsp;</td>
		<td class="tr_right">
			<p>
				<!--      <select name="selMC" id="sel_mc"  onchange="selectMC(this);" class="easyui-validatebox">    -->
				<!--   <option></option> 	
                   <option>到3#室开会</option>  
                   <option>请到驾驶室</option>  
                  
                   </select>   -->
				<input id="selMC" class="easyui-combobox" name="selMC"
					data-options="valueField:'text',
               textField:'text',url:'${pageContext.request.contextPath}/message/messageAction!getMsgJSON.action'">

			</p>
			<p>
				<textarea id="msgContent" name="msgContent" cols="50" rows="8"
					class="easyui-validatebox"
					data-options="required:true,missingMessage:'请输入内容'"></textarea>
			</p>
		</td>
	</tr>

	<tr class="row-even">
		<td class="tr_left"><span class="required">*</span>发送类型:&nbsp;</td>
		<td class="tr_right"><label><input type="radio"
				name="msgType" value="1" checked="checked" onclick="hide()" />全部</label>&nbsp;&nbsp;&nbsp;
			<label><input type="radio" name="msgType" value="0"
				onclick="show()" />多人</label></td>
	</tr>
	<!--  
        <tr id="selectEmp" style="display:none">
       
           <td class="tr_left"  ><span class="required">*</span>选择人员:&nbsp;</td>
            <td class="tr_right">
            <input id="cc" class="easyui-combobox" name="recUser" data-options="valueField:'id',textField:'text',multiple:true,url:'${pageContext.request.contextPath}/message/messageAction!getEmpJSON.action'">
            </td>
             </tr>
            
             <tr class="row-even">
            <td class="tr_left">
                   <span class="required">*</span>选择人员:&nbsp;    
                     
           </td>
           <td class="tr_right">
           <select multiple="multiple" id="select1" style="width:200px"> </select>
           <select multiple="multiple" id="select2" name="recUser" style="width:200px">  </select>
                       
             </td>
        </tr>
        <tr class="row-even">
        <td class="tr_left">
         <span class="required">*</span>操作:&nbsp;  
        </td>
        <td class="tr_right">
        <input id="add" type="button" class="search_btn" value="右移"/>&nbsp;&nbsp;&nbsp;&nbsp;<input id="add_all" type="button"  class="search_btn" value="全部右移"/>
        <input id="remove" type="button" class="search_btn" value="左移"/>&nbsp;&nbsp;&nbsp;&nbsp;<input id="remove_all" type="button" class="search_btn" value="全部左移"/>
       
        </td>
      
        </tr>
        
          -->

	<tr class="row-even" id="su" style="display:none">
		<td class="tr_left"><span class="required">*</span>选择人员:&nbsp;</td>

		<td class="tr_right"><input type="button" id="selectEmpBt"
			value="选择" class="search_btn" onclick="selectEmp()" />
			
			<input
						type="text" id="ids" name="recUser"
						class="easyui-validatebox"
						style="display:none" />
			
			</td>

	</tr>


	<tr class="row-even">
		<td class="tr_left"><span class="required">*</span>时效(h):&nbsp;</td>
		<td class="tr_right"><input type="text" value="6"
			id="select_deviceType" name="validity" class="easyui-validatebox"
			style="width:40px"
			data-options="required:true,missingMessage:'请填写时效小时数'" /> &nbsp;<span
			class="required">*</span>自定义发送时间: <input id="ttt" name="timing"
			style="width:150px"></td>


	</tr>
</table>
<div id="dd" class="easyui-dialog" title="人员选择"
	style="width:500px;height:200px;"
	data-options="closed:true,resizable:true,modal:true,buttons:[{
			text:'保存',handler:function save(){
			 var rows = $('#empdatagrid').datagrid('getChecked');
			  if (rows.length <= 0) {
                    $.messager.alert('提示', '没有选择任何记录');
                      } else {
                     var itemIds = [];
                     $.each(rows, function (i, item) {
                    itemIds.push(item.id);
                    });
			 document.getElementById('ids').value= itemIds.join(',');
			}  
			  
			  
			    $('#dd').window('close');      
			}},{text:'关闭',handler:function close(){
			
			$('#dd').window('close');
			}
			}]">


	<div title="选择人员">
		<form id="emp_datasource_query_form" method="post">
                   
			<table border="0" cellpadding="0" cellspacing="0" height="100%"
				width="100%">
				<tr>

					<td style="width:1%;text-align:left;" nowrap="nowrap"><label
						for="edatasource_datsourcename">姓&emsp;&emsp;名：</label> <input
						type="text" id="edatasource_datsourcename" name="ename"
						class="easyui-validatebox"
						data-options="validType:'specialCharFilter'" /></td>


					<td colspan="2" style="width:25%;text-align:left;" nowrap="nowrap">
						<input type="button" id="ebtnQuery" value="查 询" class="search_btn" />
						<input type="button" id="ebtnReset" value="重 置" class="reset_btn" />
					</td>
				</tr>

			</table>
                 
         
	              <table id="empdatagrid"></table>
               
		</form> 
</div>

	</div>
	

